package net.sf.xoperator.ui.trans;

import java.io.File;
import java.io.FileInputStream;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import net.sf.xoperator.configuration.PersistentKSConfiguration;

/**
 * holds the configuration data for the <code>SPARLQ2TextTransformer</code>.
 * This is at the moment just the location of the xsl sheet. The config is also
 * repsonsible for converting this into a streamsource, so if the later the
 * stylesheet should not be read from the file system, there is no need to
 * change the transformer, just the config.
 * 
 * @author joerg
 * 
 */
public class SPARQL2TextConfig extends PersistentKSConfiguration{

	private File styleSheet;
	
	private boolean obsolete = false;

	public File getStyleSheet() {
		return this.styleSheet;
	}

	public void setStyleSheet(File styleSheet) {
		this.styleSheet = styleSheet;
	}

	public Source getStyleSheetSource() throws Exception {

		return new StreamSource(new FileInputStream(this.styleSheet));

	}

	@Override
	public String getName() {
		// i dont expect any multiple instances of this to be required, so a static name should be fine
		return "SPARQL2TextConfiguration";
	}

@Override
public void setObsolete(boolean obsolete) {
	this.obsolete = obsolete;
}
@Override
public boolean isObsolete() {
	return this.obsolete;
}

}
